#ifndef __CHESS_PIECE_H__
#define __CHESS_PIECE_H__

#define DIM 19

typedef enum Color {
    BLACK = 0,
    WHITE = 1
} COLOR;

class ChessPiece {
public:
    ChessPiece(COLOR color);
    ~ChessPiece();

private:
    COLOR color_;
};

class Player {
public:
    Player();
    ~Player();

    int getLevel();

private:
    int level_;
};

class User : public Player {
public:
    User(char *name);
    ~User();

    char *getName();
    unsigned int getGameNum();
    unsigned int getWinGameNum();

    void addOneWinGame();
    void addOneLoseGame();

private:
    unsigned int lose_game_num_;
    unsigned int win_game_num_;
};

class ChessPlate {
public:
    ChessPlate();
    ~ChessPlate();

    void removePiece(int i, int j);
    void addPiece(int i, int j);

    bool isLocationOccupied(int i, int j);

private:
    bool occupy_flag_[DIM][DIM];
    COLOR color_[DIM][DIM];
};

class Timer {
public:
    Timer(unsigned int total_time);
    ~Timer();

    void elapseTime();

private:
    unsigned int total_time_;
    unsigned int remaining_time_;
};

class UserTracker {
public:
    UserTracker(COLOR coler);
    ~UserTracker();

    ChessPiece *getPiece();
    bool playPiece(ChessPlate *plate);

private:
    User *user_;
    ChessPiece *pieces_;
    Timer *timer_;
};

class ChessGame {
public:
    ChessGame();
    ~ChessGame();

    void init();
    void start();
    void nextPlay()
    bool isWin();
    User *getWinUser();

private:
    ChessPlate *chess_plate_;
    UserTrack *tracker1_;
    UserTrack *tracker2_;
};

// 1. The chess game consists of chess pieces and the plate;
// 2. It also have the users and computer players;
// 3. There is also a tracker class to track the remaining pieces and time of each player
// 4. Timer to track the remaining time of each player;
// 5. Game class for playing a game.

#endif

